home *** CD-ROM | disk | FTP | other *** search
- unit TrimMem;
- //
- // Code courtesy of Roy Nelson (rnelson@inprise.com),
- // Inprise European Professional Support
- //
- // Call TrimWorkingSet from you project file or from a package
- // to reduce the memory overhead - note that this will only work
- // on Windows NT.
- //
- // From Delphi Magazine article "Slimming the fat off your Apps"
- // by Hallvard Vassbotn, hallvard@falcon.no
- //
- interface
-
- procedure TrimWorkingSet;
-
- implementation
-
- uses
- Windows,
- SysUtils;
-
- procedure TrimWorkingSet;
- var
- MainHandle : THandle;
- begin
- MainHandle := OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessID);
- SetProcessWorkingSetSize(MainHandle,DWORD(-1),DWORD(-1));
- CloseHandle(MainHandle);
- end;
-
- end.
-